FROM docker.m.daocloud.io/node:20-alpine AS builder
WORKDIR /app  
RUN npm install -g lerna@latest pnpm@latest unbuild@latest --registry=https://registry.npmmirror.com
COPY . .
# # 首先复制包管理相关文件
# COPY package.json .
# COPY pnpm-workspace.yaml .
# COPY lerna.json .

# # 然后复制配置文件
# COPY nx.json .
# COPY tsconfig.json .
# COPY typedoc.json .

# # 最后复制源代码目录
# COPY platforms/ .
# COPY packages/ .
# COPY scripts/ .
# COPY create-vtj/ .
# COPY docs/ .
# COPY dev/ .
RUN npm run setup

RUN npx lerna run build --scope=@vtj/pro --include-dependencies

  
# 运行阶段  
FROM docker.m.daocloud.io/nginx:1.24.0-bullseye  
COPY --from=builder /app/platforms/pro/dist /usr/share/nginx/html  
EXPOSE 80  
CMD ["nginx", "-g", "daemon off;"]
